import java.io.*;
import java.net.*;
public class Bot {
	
	public static void main(String[] args){
	Socket socket = null; // obiekt socketu
	PrintWriter out = null; // metoda wysylania danych
	BufferedReader in = null;
	int pr=4444;
    String sr="localhost";
    String[] help =null;
    String IDo;
    String casho;
    String Poto;
    String Maxbeto;
    String card1;
    String card2;
    String card3;
    String card4;
    int playercash;
    int maxbet1=0;
    int maxbet2=0;
    String Allin="0";
    int exbt=0;
    int gm=1;
    try {
        socket = new Socket(sr,pr);
        out = new PrintWriter(socket.getOutputStream(), true);
        in = new BufferedReader(new InputStreamReader(socket.getInputStream()));
    }
    catch (UnknownHostException e) {
        System.out.println("Unknown host: localhost"); System.exit(1);
    }
    catch  (IOException e) {
        System.out.println("No I/O"); System.exit(1);
    }
    try {
    System.out.println(in.readLine());
    IDo=in.readLine();
    casho=in.readLine();
    Poto="0";
    Maxbeto="0";
    playercash=Integer.parseInt(casho);
    System.out.println(in.readLine());
    out.println(IDo);
    while(gm==1){
    System.out.println(in.readLine());
    out.println(IDo);
	 help=in.readLine().split(" ");
    if((help[0].equals("B"))||(help[0].equals("S"))){
    	playercash=playercash-Integer.parseInt(help[1]);
    	casho=""+playercash;
    }
    System.out.println(help[2]+" "+help[3]);
    Poto=in.readLine();
    help=null;
    out.println(IDo);
    System.out.println(in.readLine());
    
    help=in.readLine().split(" ");
    card1=help[0];
    card2=help[1];
    card3=help[2];
    card4=help[3];
    Poto=in.readLine();
    Maxbeto=in.readLine();
    System.out.println(in.readLine());
    out.println(IDo);
    System.out.println(in.readLine());
    for(int js=0 ; js<3; js++){
   
    if(Integer.parseInt(Maxbeto)>Integer.parseInt(casho)){
    	Allin="1";
    	out.println("Allin "+playercash);
    	playercash=0;
    	casho=""+playercash;
        System.out.println(in.readLine());
    }
    else if((Maxbeto.equals(0))){
    	out.println("bet "+"5");
    	Maxbeto="5";
    	playercash=playercash-5;
    	casho=""+playercash;
        System.out.println(in.readLine());
    }
    else{
    	out.println("bet "+Maxbeto);
    	playercash=playercash-Integer.parseInt(Maxbeto);
    	casho=""+playercash;
        System.out.println(in.readLine());
    }
    out.println(IDo);
    help=in.readLine().split(" ");
    
    if(!help[0].equals("Send")){
    	if(exbt!=2){
    		out.println(card1+" "+card2+" "+card3+" "+card4);
    		card1="X";
    		card2="X";
    		card3="X";
    		card4="X";
    		help=in.readLine().split(" ");
    		card1=help[0];
    		card2=help[1];
    		card3=help[2];
    		card4=help[3];
    		maxbet2=Integer.parseInt(Maxbeto);
    		Poto=in.readLine();
            Maxbeto=in.readLine();
			System.out.println(in.readLine());

            exbt++;
    	}
    	else{
    		out.println(card1+" "+card2+" "+card3+" "+card4);
    		card1="X";
    		card2="X";
    		card3="X";
    		card4="X";
    		help=in.readLine().split(" ");
    		card1=help[0];
    		card2=help[1];
    		card3=help[2];
    		card4=help[3];
    		maxbet2=Integer.parseInt(Maxbeto);
    		Poto=in.readLine();
            Maxbeto=in.readLine();
			System.out.println(in.readLine());
    	}
    	out.println(IDo);
        System.out.println(in.readLine());
    }
    else
    	break;
    }
    out.println(card1+" "+card2+" "+card3+" "+card4);
	System.out.println(in.readLine());
	out.println(IDo);
    System.out.println(in.readLine());
   
    out.println(card1+" "+card2+" "+card3+" "+card4);
	help=in.readLine().split(" ");
	System.out.println(help[0]+" "+help[2]);
	playercash=playercash+Integer.parseInt(help[1]);
	casho=""+playercash;
	Poto=in.readLine();
	  card1="";
	  card2="";
	  card3="";
	  card4="";
	  out.println(IDo);
	 
    }
    
    
    
    }
    catch (IOException e) {
        System.out.println("Read failed"); System.exit(1);
    }
	}
}
